﻿namespace UnitFundProfitability.BusinessLogic
{
	using System;

	/// <summary>
	/// Represents a profitability of a single fund.
	/// </summary>
	public class FundProfitability
	{
		#region Fields
		private DateTime _startDate;
		private DateTime _endDate;
		private Guid _fundId;
		private string _fundName;
		private decimal _startValue;
		private decimal _operationsAmount;
		private decimal _endValue;
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the start date.
		/// </summary>
		/// <value>The start date.</value>
		public DateTime StartDate
		{
			get
			{
				return _startDate;
			}

			set
			{
				_startDate = value;
			}
		}

		/// <summary>
		/// Gets or sets the end date.
		/// </summary>
		/// <value>The end date.</value>
		public DateTime EndDate
		{
			get
			{
				return _endDate;
			}

			set
			{
				_endDate = value;
			}
		}

		/// <summary>
		/// Gets or sets the fund ID.
		/// </summary>
		/// <value>The fund ID.</value>
		public Guid FundId
		{
			get
			{
				return _fundId;
			}

			set
			{
				_fundId = value;
			}
		}

		/// <summary>
		/// Gets or sets the name of the fund.
		/// </summary>
		/// <value>The name of the fund.</value>
		public string FundName
		{
			get
			{
				return _fundName;
			}

			set
			{
				_fundName = value;
			}
		}

		/// <summary>
		/// Gets or sets the start value.
		/// </summary>
		/// <value>The start value.</value>
		public decimal StartValue
		{
			get
			{
				return _startValue;
			}

			set
			{
				_startValue = value;
			}
		}

		/// <summary>
		/// Gets or sets the operations amount.
		/// </summary>
		/// <value>The operations amount.</value>
		public decimal OperationsAmount
		{
			get
			{
				return _operationsAmount;
			}

			set
			{
				_operationsAmount = value;
			}
		}

		/// <summary>
		/// Gets the expected end value.
		/// </summary>
		/// <value>The expected end value.</value>
		public decimal ExpectedEndValue
		{
			get
			{
				return StartValue + OperationsAmount;
			}
		}

		/// <summary>
		/// Gets or sets the end value.
		/// </summary>
		/// <value>The end value.</value>
		public decimal EndValue
		{
			get
			{
				return _endValue;
			}

			set
			{
				_endValue = value;
			}
		}

		/// <summary>
		/// Gets the profitability.
		/// </summary>
		/// <value>The profitability.</value>
		public decimal Profitability
		{
			get
			{
				return (EndValue - ExpectedEndValue) / ExpectedEndValue;
			}
		}
		#endregion
	}
}
